package com.yuven.appframework.widget

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.chad.library.adapter.base.loadmore.BaseLoadMoreView
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.yuven.appframework.R
import org.jetbrains.annotations.NotNull


class CustomLoadMoreView : BaseLoadMoreView() {
    @NotNull
    override fun getRootView(@NotNull parent: ViewGroup): View {
        // 整个 LoadMore 布局
        return LayoutInflater.from(parent.context).inflate(R.layout.layout_base_quick_adapter_load_more_view, parent, false)
    }

    @NotNull
    override fun getLoadingView(@NotNull holder: BaseViewHolder): View {
        // 布局中 “加载中”的View
        return holder.getView(R.id.load_more_loading_view)
    }

    @NotNull
    override fun getLoadComplete(@NotNull holder: BaseViewHolder): View {
        // 布局中 “当前一页加载完成”的View
        return holder.getView(R.id.load_more_load_complete_view)
    }

    @NotNull
    override fun getLoadEndView(@NotNull holder: BaseViewHolder): View {
        // 布局中 “全部加载结束，没有数据”的View
        return holder.getView(R.id.load_more_load_end_view)
    }

    @NotNull
    override fun getLoadFailView(@NotNull holder: BaseViewHolder): View {
        // 布局中 “加载失败”的View
        return holder.getView(R.id.load_more_load_fail_view)
    }

}